

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using JTC.MiniCommerce.Localization;
using JTC.MiniCommerce.Store;
using JTC.MiniCommerce.Store.Web;
using SubSonic.Utilities;

namespace JTC.MiniCommerce.Web {
  public partial class site : SiteMasterPage {

    #region Page Events

    /// <summary>
    /// Pres the init.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
    protected void PreInit(object sender, EventArgs e) {
      string theme = "MiniCommerce";
      if(!string.IsNullOrEmpty(SiteSettings.Theme)) {
        theme = SiteSettings.Theme;
      }
      this.Page.Theme = theme;
    }

    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e) {
      if(!string.IsNullOrEmpty(SiteSettings.SiteLogo)) {
       hlLogo.ImageUrl = SiteSettings.SiteLogo;
      }
      hlLogo.NavigateUrl = Utility.GetSiteRoot();
      LoadNavigation();
    }

    #endregion

    #region Methods

    #region Private

    /// <summary>
    /// Loads the navigation.
    /// </summary>
    private void LoadNavigation() {
      DataSet ds = new PageController().FetchPageList();
      xmlDataSource.EnableCaching = false;
      xmlDataSource.CacheDuration = 0;
      xmlDataSource.Data = ds.GetXml();
    }

    #endregion

    #endregion

    #region Properties

    public ScriptManager ScriptManager {
      get {
        return scriptManager;
      }
    }

    #endregion

  }
}
